kill a position normilization clone caught by codacy. (#1333)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Fri, 30 Aug 2024 23:32:15 +0000 (17:32 -0600)
committerGitHub <noreply@github.com>
Fri, 30 Aug 2024 23:32:15 +0000 (17:32 -0600)
gdb.cc

diff --git a/gdb.cc b/gdb.cc
index 7cd965ed6f9311422ee030fd3ef37711bd593b02..baf0773c8df47a9ec452d28c84980d5a10711dbe 100644 (file)
--- a/gdb.cc
+++ b/gdb.cc
@@ -1152,26 +1152,7 @@ GdbFormat::write_header()
 void
 GdbFormat::gdb_check_waypt(Waypoint* wpt)
 {
-  double lat_orig = wpt->latitude;
-  double lon_orig = wpt->longitude;
-
-  if (wpt->latitude < -90) {
-    wpt->latitude += 180;
-  } else if (wpt->latitude > +90) {
-    wpt->latitude -= 180;
-  }
-  if (wpt->longitude < -180) {
-    wpt->longitude += 360;
-  } else if (wpt->longitude > +180) {
-    wpt->longitude -= 360;
-  }
-
-  if ((wpt->latitude < -90) || (wpt->latitude > 90.0))
-    fatal("Invalid latitude %f in waypoint %s.\n",
-          lat_orig, !wpt->shortname.isEmpty() ? qPrintable(wpt->shortname) : "<no name>");
-  if ((wpt->longitude < -180) || (wpt->longitude > 180.0))
-    fatal("Invalid longitude %f in waypoint %s.\n",
-          lon_orig, !wpt->shortname.isEmpty() ? qPrintable(wpt->shortname) : "<no name>");
+  wpt->NormalizePosition();
 }
 
 /*-----------------------------------------------------------------------------*/